<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
</head>
<body>
	<div class="panel panel-default panel-content" style="overflow: auto;">
		<div class="panel-heading" style="position: fixed;height: 63px;width: 99%;">
		<table style="width: 99%;">
			<tr>
				<th >报价公司:</th>
				<td>${quote.companyName!} </td>
				<!--<td class="w80 "></td>-->
				<th>报价时间:</th>
				<td>[#if quote.quoteDate??]${quote.quoteDate?string('yyyy-MM-dd')}[/#if]</td>
				<!--<td class="w80 "></td>-->
				<th>联系人:</th>
				<td> 
					${quote.contacter!}
				</td>
				<!--<td class="w80 "></td>-->
				<th>联系电话:</th>
				<td>${quote.phone!}</td>
				<!--<td class="w80 "></td>-->
				<td>&nbsp;&nbsp;&nbsp;&nbsp;
					[#if quote.state == EnqQuoteEnum.QUT_STAY.index && quoteItems?? && quoteItems?size > 0]
					<button type="button" class="btn   btn-success" onclick="changeState(${quote.id!} , 1)" >通过审核</button>
					[/#if ]
					[#if !quote.suggest?? || quote.suggest == '']
					<button type="button" class="btn    btn-default" onclick="changeState(${quote.id!} , 0)" >退回修改</button>
					[/#if]
				</td>
			</tr>
			[#if enquiry?? && enquiry.qtype == 1]
			<tr>
				[#if enquiry.providefiles?? && enquiry.providefiles?contains('1')]
				<th>解决方案：</th>
				<td colspan="5" [#if solvepath ??]onclick="window.open('${solvepath}')" style="cursor: pointer" [/#if]>${solvepath!'未上传'}</td>
				[/#if]
				[#if enquiry.providefiles?? && enquiry.providefiles?contains('2')]
				<th>拓扑图：</th>
				<td colspan="8" [#if solvepath ??]onclick="window.open('${tppath}')" style="cursor: pointer"[/#if]>${tppath!'未上传'}</td>
				[/#if]
			</tr>
			[/#if]
			<tr>
				<th>
					报价状态:
				</th>
				<td>${allQuoteStat[quote.state?string]!}</td>
				<th>
					报价总价:
				</th>
				<td>${quote.totalPrice!}</td>
				[#if quote.enclosure?? && quote.enclosure!="" ]
                    <!--<td class="w80 "></td>-->
				<th>
					报价附件:
				</th>
				<td >
                    <a href="${quote.enclosure!}" target="_blank">${quote.enclosureName!}</a>
				</td>
				[/#if]
			</tr>
		</table>
	</div>
	
	

	<form id="itemform"  method="post"  style="padding-top: 63px;"  >
	<div >
		<table  id="fenxi"  class="table table-hover table-bordered table-striped table-condensed">
			<thead>
				<tr>
					<th>序号</th>
					<th>系统名称</th>
					<th>产品名称</th>
					<th>品牌</th>
					<th>型号</th>
					<th>数量</th>
					<th>单位</th>
					<th>单价</th>
					<th>小计</th>
					<th>技术参数</th>
				</tr>
			</thead>
			<tbody>
			[#if quoteItems?? ]
				[#list quoteItems as qi]
					<tr>
						<td>${qi_index + 1}</td>
						<td>${qi.categoryName!}</td>
						<td>${qi.productName!}</td>
						<td>${qi.brand!}</td>
						<td>${qi.model!}</td>
						<td>${qi.quantity!}</td>
						<td>${qi.unit!}</td>
						<td>${qi.unitprice!}</td>
						<td>${qi.totalPrice!}</td>
						<td>${qi.descr!}</td>
					</tr>
				[/#list]
			[/#if]
			</tbody>
		</table>
		</div>
		</form>

	</div>
<style>
</style>

<script>

	function changeState(quoteId , state){
		if(quoteId){
			if(state == 1){
				artDialog.confirm("是否确定"+(state == 0 ? "退回修改" : "通过审核")+"？" , function(){
					$.ajax({
						url : '/enq/o_quote_change_state.do' ,
						type : 'post' ,
						dataType : 'json' ,
						data : {quoteId : quoteId , state : state},
						success : function (data) {
							if(data.success){
								alert((state == 0 ? "退回修改" : "通过审核") + "成功！");
								location.reload();
							}else{
								alert(data.msg);
								//							location.reload();
							}
						}
					});
				});
			}else if(state == 0){
				artDialog.prompt("请输入修改意见" , function (value , $this , $here) {
					if(value == ''){
						artDialog.alert("请输入意见");
						return false;
					}

					$.ajax({
						url : '/enq/o_quote_change_state.do' ,
						type : 'post' ,
						dataType : 'json' ,
						data : {quoteId : quoteId , state : state , suggest:value},
						success : function (data) {
							if(data.success){
								alert((state == 0 ? "退回修改" : "通过审核") + "成功！");
								location.reload();
							}else{
								alert(data.msg);
								//							location.reload();
							}
						}
					});
				});
			}
		}
	}

</script>
</body>
</html>	